﻿namespace MovieTicket.WebApi.Controllers
{
    using System.Collections.Generic;
    using System.Net;
    using System.Net.Http;
    using System.Net.Http.Headers;
    using System.Web;
    using System.Web.Http;

    /// <summary>
    /// Class ValuesController
    /// </summary>
    public class ValuesController : ApiController
    {
        #region Public Methods and Operators

        /// <summary>
        /// Deletes the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        public void Delete(int id)
        {
        }

        /// <summary>
        /// Gets this instance.
        /// </summary>
        /// <returns>IEnumerable{System.String}.</returns>
        public IEnumerable<string> Get()
        {
            return new[] { "value1", "value2" };
        }

        /// <summary>
        /// Gets the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns>System.String.</returns>
        public string Get(int id)
        {
            return "value";
        }

        /// <summary>
        /// The get image.
        /// </summary>
        /// <returns>
        /// The <see cref="HttpResponseMessage"/>.
        /// </returns>
        public HttpResponseMessage GetImage()
        {
            byte[] bytes = System.IO.File.ReadAllBytes(HttpContext.Current.Server.MapPath("~/Content/Kendo.png"));
            var result = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(bytes) };
            result.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png");
            return result;
        }

        /// <summary>
        /// Gets my values.
        /// </summary>
        /// <returns>System.String.</returns>
        public string GetMyValues()
        {
            return "My values";
        }

        /// <summary>
        /// Posts the specified value.
        /// </summary>
        /// <param name="value">The value.</param>
        public void Post([FromBody] string value)
        {
        }

        /// <summary>
        /// Puts the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="value">The value.</param>
        public void Put(int id, [FromBody] string value)
        {
        }

        #endregion
    }
}